<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1 , user-scalable=no">
    <title>图片分享社区后台</title>
 <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/CSS/bootstrap.css" />
  <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/CSS/bootstrap-maizi.css" />
</head>
<body>
<!--导航-->
<nav class="navbar navbar-default">
    <div class="container">
        <!--小屏幕导航按钮和logo-->
        <div class="navbar-header">
            <button class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a href="head.action" class="navbar-brand">图片分享社区后台</a>
        </div>
        <!--小屏幕导航按钮和logo-->
        <!--导航-->
        <div class="navbar-collapse collapse">
             <ul class="nav navbar-nav">
                <li ><a href="head.action"><span class="glyphicon glyphicon-home"></span>&nbsp;&nbsp;后台首页</a></li>
                <li class="active"><a href="usermanger.action"><span class="glyphicon glyphicon-user"></span>&nbsp;&nbsp;用户管理</a></li>
                <li><a href="contentmanger.action"><span class="glyphicon glyphicon-list-alt"></span>&nbsp;&nbsp;内容管理</a></li>
                <li><a href="labelmanger.action"><span class="glyphicon glyphicon-tags"></span>&nbsp;&nbsp;标签管理</a></li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
               <li class="dropdown">
                    <a id="dLabel" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                       <s:property value="#session.USER_NAME"/>
                        <span class="caret"></span>
                    </a>
                    <ul class="dropdown-menu" aria-labelledby="dLabel">
                        <li><a href="<%=basePath%>"><span class="glyphicon glyphicon-screenshot"></span>&nbsp;&nbsp;前台首页</a></li>
                        
                        <li><a href="personsetting.action?id=<s:property value="#session.USER_ID"/>"><span class="glyphicon glyphicon-cog"></span>&nbsp;&nbsp;个人设置</a></li>
      
                    </ul>
                </li>
                <li><a href="logout.action"><span class="glyphicon glyphicon-off"></span>&nbsp;&nbsp;退出</a></li>
            </ul>
        </div>
        <!--导航-->

    </div>
</nav>
<!--导航-->


<div class="container">
    <div class="row">
        <div class="col-md-2">
            <div class="list-group">
                <a href="usermanger.action" class="list-group-item ">用户管理</a>
                <a href="usersearch.action" class="list-group-item">用户搜索</a>
               <a href="insertuser.action" class="list-group-item active">添加用户</a>
            </div>
        </div>
        <div class="col-md-10">
            <div class="page-header">
                <h1>用户添加</h1>
            </div>
            <ul class="nav nav-tabs">
                <li >
                    <a href="usermanger.action">用户列表</a>
                </li>
                <li>
                    <a href="usersearch.action">用户搜索</a>
                </li>
                <li class="active">
                     <a href="insertuser.action">添加用户</a>
                </li>
          </ul>
           <form action="insertuserresult.action" method="post" onsubmit="return check()">
                    <div class="form-group">
                        <label for="addname">用户名</label>
                        <input type="text" name="user.username" id="username" class="form-control" placeholder="用户名" value="" required="required">
                    </div>
                    <div class="form-group">
                        <label for="addpassword">用户密码</label>
                        <input type="password" name="user.password" id="userpassword" class="form-control" placeholder="请输入用户密码" value="" required="required">
                    </div>
                    <div class="form-group">
                        <label for="addpassword1">确认用户密码</label>
                        <input type="password" name="confimpassword"   id="confimpassword" class="form-control" placeholder="请确认输入用户密码" required="required">
                   <span style="display:none;color:red;" id="info">*用户密码和确认密码不一致</span>
                    </div>
                    <div class="form-group">
                        <label for="addemail">请输入用户账号</label>
                        <input type="number" name="user.loginnumber" id="loginmunber" class="form-control" placeholder="请输入用户账号" required="required">
                    </div>
               <button type="submit" class="btn btn-info pull-right" id="submit">添加用户</button>               
                </form>
        </div>
    </div>
</div>
<div class="modal fade" id="my" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel" style="text-align:center;">操作提示</h4>
      </div>
      <div class="modal-body">
                     <h5 style="text-align:center;">密码与确认密码不相同</h5>
      </div>
      <div class="modal-footer">
    
        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
      </div>
    </div>
  </div>
</div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel" style="text-align:center;">操作提示</h4>
      </div>
      <div class="modal-body">
                     <h5 style="text-align:center;">请填写完整表单！！</h5>
      </div>
      <div class="modal-footer">
    
        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
      </div>
    </div>
  </div>
</div>
<!--footer-->
<footer>
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <p>
                    Copyright&nbsp;©&nbsp;2012-2015&nbsp;&nbsp;www.sharephoto.com&nbsp;&nbsp;粤ICP备13014270号-4
                </p>
            </div>
        </div>
    </div>
</footer>
<!--footer-->


<script src="${pageContext.request.contextPath}/JS/jquery-1.12.3.min.js"></script>
<script src="${pageContext.request.contextPath}/JS/bootstrap.min.js"></script>
<script type="text/javascript">
function validpassword(){
var password=$("#userpassword").val();
var confimpassword=$("#confimpassword").val();
if(password!==confimpassword){
$("#info").css("display","block");
$("#submit").attr("disabled",true);   

}
else{
$("#info").css("display","none");
$("#submit").attr("disabled",false); 
}
}
    $(function(){
        $('#username').focus();
    });
    
     function check(){
   if($("#userpassword").val().trim()=="" ||$("#confimpassword").val().trem==""||$("#username").val().trem==""||$("#loginmunber").val().trem==""){
   $("#myModal").modal("show");
   return false;
   }else{
   if($("#userpassword").val().trim()!==$("#confimpassword").val().trim()){
     $("#my").modal("show");
  return false; 
  }
  else{
  return true;}
   }
  };
</script>
</body>
</html>